package com.itheima.common;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;
    private String msg;//错误消息
    private Object data;

    public static R ok(){
        R r = new R();
        r.setCode(1);
        return r;
    }

    public static R ok(Object data){
        R r = new R();
        r.setData(data);
        r.setCode(1);
        return r;
    }

    public static R error(String msg){
        R r = new R();
        r.setCode(0);
        r.setMsg(msg);
        return r;
    }

}
